?><?
class cls_discussion_item extends cls_entity_item{

  function entity(){return "discussion";}

  function data_fields(){
    return array(
       "discussion_parent_id",
       "entity_id",
       "entity_name",
       "discussion_created",
       "discussion_updated",
       "discussion_replyed",
       "discussion_title",
       "discussion_text",
       "discussion_readed",
       "discussion_archived_sent",
       "discussion_archived_rcpt",
       "avatar_id",
       "user_id",
       "creator_id",
       "discussion_visible",
    );
  }

  function readed(){parent::update($this->entity(),$this->id,array("discussion_readed"=>1));}
  function replyed(){parent::update($this->entity(),$this->id,array("discussion_replyed"=>"Now()"));}
  function archive_sent(){parent::update($this->entity(),$this->id,array("discussion_archived_sent"=>1));}
  function archive_rcpt(){parent::update($this->entity(),$this->id,array("discussion_archived_rcpt"=>1));}

  function update($id,$data){return parent::update(cls_discussion_item::entity(),$id,$data);}

}
